package com.xy.api.constant.enums;

import lombok.Getter;

import java.util.Objects;

@Getter
public enum JuheExchangeRateCodeEnum {

    USD_CAD("USDCAD", "CAD", "加元", "美元-加元"),
    USD_CHF("USDCHF", "CHF", "瑞郎", "美元-瑞郎"),
    USD_CNY("USDCNY", "CNY", "人民币", "美元-人民币"),
    USD_HKD("USDHKD", "HKD", "港元", "美元-港元"),
    USD_JPY("USDJPY", "JPY", "日元", "美元-日元"),
    USD_MYR("USDMYR", "MYR", "马币", "美元-马币"),
    USD_SGD("USDSGD", "SGD", "新加坡元", "美元-新加坡元"),
    USD_TWD("USDTWD", "TWD", "台币", "美元-台币"),
    ;

    private String code;

    private String unitCode;

    private String unitName;

    private String desc;

    JuheExchangeRateCodeEnum(String code, String unitCode, String unitName, String desc) {
        this.code = code;
        this.unitCode = unitCode;
        this.unitName = unitName;
        this.desc = desc;
    }

    public static JuheExchangeRateCodeEnum fromCode(String code) {
        for (JuheExchangeRateCodeEnum value : JuheExchangeRateCodeEnum.values()) {
            if (Objects.equals(code, value.getCode())) {
                return value;
            }
        }
        return null;
    }
}
